<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="日期" prop="complaintDate">
        <el-input
          v-model="queryParams.complaintDate"
          placeholder="请输入日期"
          clearable
          style="width: 150px;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="受理号码" prop="acceptanceNumber">
        <el-input
          v-model="queryParams.acceptanceNumber"
          placeholder="请输入受理号码"
          clearable
          style="width: 150px;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="投诉区县" prop="complaintDistrict">
        <el-input
          v-model="queryParams.complaintDistrict"
          placeholder="请输入投诉区县"
          clearable
          style="width: 150px;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="是否超时" prop="isOverTime">
        <el-select v-model="queryParams.isOverTime" placeholder="请选择是否超时" clearable style="width: 150px;"
                   @keyup.enter.native="handleQuery">
          <el-option v-for="dict in dict.type.is_over_time"
                     :key="dict.value"
                     :label="dict.label"
                     :value="dict.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:complaint:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:complaint:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:complaint:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-upload
          class="upload-demo"
          :headers="headers"
          :action="uploadUrl"
          :on-success="handleSuccess"
          :show-file-list="false"
          name="file"
          ref="upload"
          multiple>
          <el-button
            type="success"
            plain
            icon="el-icon-upload2"
            size="mini"
            v-hasPermi="['system:complaint:import']"
          >导入
          </el-button>
        </el-upload>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:complaint:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table stripe v-loading="loading" :data="complaintList"
              :expand-row-keys="expands"
              height="650"
              :row-key="gerRowKeys"
              @expand-change="handleExpandChange"
              @selection-change="handleSelectionChange">
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-row style="width: calc(100vw - 370px);padding: 0 20px;">
            <el-form :model="props.row">
              <el-col :span="6">
                <el-form-item label="工单状态">
                  <dict-tag :options="dict.type.work_order_status" :value="props.row.workOrderStatus"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="回访人员">
                  <span>{{ props.row.returningVisitor }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="日期">
                  <span>{{ props.row.complaintDate }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="受理号码">
                  <span>{{ props.row.acceptanceNumber }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="投诉唯一标识">
                  <span>{{ props.row.complaintUniqueIdentifier }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="重复投诉次数">
                  <span>{{ props.row.numberOfRepeatedComplaints }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="工单流水号">
                  <span>{{ props.row.workOrderSerialNumber }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="投诉类型">
                  <dict-tag :options="dict.type.type_of_complaint" :value="props.row.returningVisitor"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="归一化地址">
                  <span>{{ props.row.normalizedAddress }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="归一化地址(TOP统计)">
                  <span>{{ props.row.normalizedAddressStatistics }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="优先级">
                  <span>{{ props.row.priority }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="投诉区县">
                  <span>{{ props.row.complaintDistrict }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="投诉详细地址">
                  <span>{{ props.row.complaintAddress }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="问题定界">
                  <dict-tag :options="dict.type.problem_delimiting" :value="props.row.problemDelimiting"/>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="现场图片">
                  <el-image v-if="props.row.fieldFileList.length>0"
                            style="width: 100px; height: 100px"
                            :src="props.row.fieldFileList[0]"
                            :preview-src-list="props.row.fieldFileList">
                  </el-image>
                  <div v-else>暂无图片</div>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="问题描述" label-width="120">
                  <div>{{ props.row.problemDescription }}</div>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="问题分类">
                  <dict-tag :options="dict.type.problem_classification" :value="props.row.problemClassification"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="预约状态">
                  <span>{{ props.row.appointmentStatus == '0' ? '否' : '是' }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="预约客户时间">
                  <span>{{ props.row.reserveCustomerTime }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="业务分类">
                  <span>{{ props.row.serviceClassification }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="投诉网络制式">
                  <dict-tag :options="dict.type.complaint_network_system" :value="props.row.complaintNetworkSystem"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="覆盖场景">
                  <dict-tag :options="dict.type.overlay_scene" :value="props.row.overlayScene"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="当前进展">
                  <span>{{ props.row.currentProgress }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="当前环节">
                  <span>{{ props.row.currentLink }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="解决方案大类">
                  <dict-tag :options="dict.type.solution_category" :value="props.row.solutionCategory"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="解决方案大类">
                  <dict-tag :options="dict.type.solution_subclass" :value="props.row.solutionSubclass"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否存在工期">
                  <span>{{ props.row.existenceDuration }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="存在工期名称">
                  <dict-tag :options="dict.type.duration_name" :value="props.row.existenceDurationName"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="经度">
                  <span>{{ props.row.longitude }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="纬度">
                  <span>{{ props.row.latitude }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="方案处理进展">
                  <span>{{ props.row.projectProcessingProgress }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="方案是否落地">
                  <span>{{ props.row.planImplementation }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="用户10分评价意愿">
                  <dict-tag :options="dict.type.user_rating" :value="props.row.userEvaluationIntention"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否上传闭环录音">
                  <span>{{ props.row.uploadClosedLoopRecording }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="投诉安抚责任人">
                  <span>{{ props.row.complaintsAppeaseThoseResponsible }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="投诉处理组">
                  <span>{{ props.row.complaintsHandlingUnit }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="投诉工单派发日期">
                  <span>{{ props.row.dateOfComplaint }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="处理责任人更新反馈时间">
                  <span>{{ props.row.updateFeedbackTime }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="用户闭环时间">
                  <span>{{ props.row.closedLoopTime }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="具体方案">
                  <span>{{ props.row.specificScheme }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="投诉处理备注">
                  <span>{{ props.row.complaintHandlingRemarks }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="投诉是否反馈更新">
                  <span>{{ props.row.complaintFeedbackUpdate }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="自投诉起时长">
                  <span>{{ props.row.timeSinceTheComplaint }}</span>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="是否超时工单标记">
                  <dict-tag :options="dict.type.overtime_work_order_flag" :value="props.row.overtimeWorkOrderFlag"/>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                <el-form-item label="处理时间">
                  <span>{{ props.row.processingTime }}</span>
                </el-form-item>
              </el-col>
            </el-form>
          </el-row>
        </template>
      </el-table-column>
      <el-table-column type="index" width="55" align="center"/>
      <el-table-column min-width="100px" label="工单状态" align="center" prop="workOrderStatus">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.work_order_status" :value="scope.row.workOrderStatus"/>
        </template>
      </el-table-column>
      <el-table-column min-width="100px" label="回访人员" align="center" prop="returningVisitor"/>
      <el-table-column min-width="150px" label="日期" align="center" prop="complaintDate"/>
      <el-table-column min-width="200px" label="受理号码" align="center" prop="acceptanceNumber" show-overflow-tooltip/>
      <el-table-column min-width="200px" label="投诉唯一标识" align="center" prop="complaintUniqueIdentifier"
                       show-overflow-tooltip/>
      <el-table-column min-width="100px" label="重复投诉次数" align="center" prop="numberOfRepeatedComplaints"/>
      <el-table-column min-width="250px" label="工单流水号" align="center" prop="workOrderSerialNumber"/>

      <el-table-column min-width="100px" label="投诉类型" align="center" prop="typeOfComplaint">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.type_of_complaint" :value="scope.row.typeOfComplaint"/>
        </template>
      </el-table-column>
      <el-table-column min-width="150px" label="归一化地址" align="center" prop="normalizedAddress"
                       show-overflow-tooltip/>
      <el-table-column min-width="150px" label="归一化地址(TOP统计)" align="center" prop="normalizedAddressStatistics"
                       show-overflow-tooltip/>
      <el-table-column min-width="100px" label="优先级" align="center" prop="priority">

      </el-table-column>
      <el-table-column min-width="100px" label="投诉区县" align="center" prop="complaintDistrict">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.complaint_district" :value="scope.row.complaintDistrict"/>
        </template>
      </el-table-column>
      <el-table-column min-width="200px" label="投诉详细地址" align="center" prop="complaintAddress"
                       show-overflow-tooltip/>
      <el-table-column min-width="200px" label="问题描述" align="center" prop="problemDescription"
                       show-overflow-tooltip/>
      <el-table-column min-width="100px" label="问题定界" align="center" prop="problemDelimiting" show-overflow-tooltip>
        <template slot-scope="scope">
          <dict-tag :options="dict.type.problem_delimiting" :value="scope.row.problemDelimiting"/>
        </template>
      </el-table-column>
      <el-table-column min-width="150px" label="问题分类" align="center" prop="problemClassification"
                       show-overflow-tooltip>
        <template slot-scope="scope">
          <dict-tag :options="dict.type.problem_classification" :value="scope.row.problemClassification"/>
        </template>
      </el-table-column>
      <el-table-column min-width="100px" label="业务分类" align="center" prop="serviceClassification"/>
      <el-table-column min-width="100px" label="投诉网络制式" align="center" prop="complaintNetworkSystem">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.complaint_network_system" :value="scope.row.complaintNetworkSystem"/>
        </template>
      </el-table-column>
      <el-table-column min-width="100px" label="覆盖场景" align="center" prop="overlayScene">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.overlay_scene" :value="scope.row.overlayScene"/>
        </template>
      </el-table-column>
      <el-table-column min-width="200px" label="当前进展" align="center" prop="currentProgress"
                       show-overflow-tooltip="show-overflow-tooltip"/>
      <el-table-column min-width="200px" label="当前环节" align="center" prop="currentLink"/>
      <el-table-column min-width="100px" label="解决方案大类" align="center" prop="solutionCategory">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.solution_category" :value="scope.row.solutionCategory"/>
        </template>
      </el-table-column>
      <el-table-column min-width="150px" label="解决方案小类" align="center" prop="solutionSubclass">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.solution_subclass" :value="scope.row.solutionSubclass"/>
        </template>
      </el-table-column>
      <el-table-column min-width="100px" label="是否存在工期" align="center" prop="existenceDuration"/>
      <el-table-column min-width="100px" label="存在工期名称" align="center" prop="existenceDurationName"
                       show-overflow-tooltip>
        <template slot-scope="scope">
          <dict-tag :options="dict.type.duration_name" :value="scope.row.existenceDurationName"/>
        </template>
      </el-table-column>
      <el-table-column min-width="150px" label="具体方案" align="center" prop="specificScheme" show-overflow-tooltip/>
      <el-table-column min-width="150px" label="经度" align="center" prop="longitude"/>
      <el-table-column min-width="150px" label="纬度" align="center" prop="latitude"/>
      <el-table-column min-width="150px" label="方案处理进展" align="center" prop="projectProcessingProgress"/>
      <el-table-column min-width="150px" label="方案是否落地" align="center" prop="planImplementation"/>
      <el-table-column min-width="150px" label="用户10分评价意愿" align="center" prop="userEvaluationIntention">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.user_rating" :value="scope.row.userEvaluationIntention"/>
        </template>
      </el-table-column>
      <el-table-column min-width="150px" label="是否上传闭环录音" align="center" prop="uploadClosedLoopRecording"/>
      <el-table-column min-width="150px" label="投诉安抚责任人" align="center"
                       prop="complaintsAppeaseThoseResponsible"/>
      <el-table-column min-width="150px" label="投诉处理组" align="center" prop="complaintsHandlingUnit"/>
      <el-table-column min-width="150px" label="投诉工单派发日期" align="center" prop="dateOfComplaint"/>
      <el-table-column min-width="170px" label="处理责任人更新反馈时间" align="center" prop="updateFeedbackTime"/>
      <el-table-column min-width="150px" label="用户闭环时间" align="center" prop="closedLoopTime"/>
      <el-table-column min-width="150px" label="投诉处理备注" align="center" prop="complaintHandlingRemarks"
                       show-overflow-tooltip/>
      <el-table-column min-width="150px" label="投诉是否反馈更新" align="center" prop="complaintFeedbackUpdate"
                       show-overflow-tooltip/>
      <el-table-column min-width="150px" label="自投诉起时长" align="center" prop="timeSinceTheComplaint"
                       show-overflow-tooltip/>
      <el-table-column min-width="150px" label="是否超时工单标记" align="center" prop="overtimeWorkOrderFlag"
                       show-overflow-tooltip>
        <template slot-scope="scope">
          <dict-tag :options="dict.type.overtime_work_order_flag" :value="scope.row.overtimeWorkOrderFlag"/>
        </template>
      </el-table-column>
      <el-table-column min-width="100px" label="处理时间" align="center" prop="processingTime"/>
      <el-table-column min-width="200px" label="操作" align="center" class-name="small-padding fixed-width"
                       width="120px" fixed="right">
        <template slot-scope="scope">
          <!--          <el-button
                      size="mini"
                      type="text"
                      icon="el-icon-edit"
                      @click="handleUpdate(scope.row)"
                      v-hasPermi="['system:complaint:edit']"
                    >修改
                    </el-button>-->

          <el-button
            size="mini"
            type="text"
            icon="el-icon-download"
            @click="downloadImages(scope.row)"
            v-hasPermi="['system:complaint:edit']"
          >下载现场资料
          </el-button>

          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:complaint:remove']"
          >删除
          </el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改投诉问题对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="180px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="导入时间" prop="recordDate">
              <el-input
                v-model="form.recordDate"
                placeholder="请输入导入时间" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="更新时间" prop="updateTime">
              <el-input
                v-model="form.updateTime"
                placeholder="请输入更新时间" disabled
              />
            </el-form-item>
          </el-col>
          <el-col span="8">
            <el-form-item label="日期" prop="complaintDate">
              <el-date-picker v-model="form.complaintDate" type="date" placeholder="选择日期时间" value-format="yyyy/MM/dd"
                              style="width: 100%;"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="受理号码" prop="acceptanceNumber">
              <el-input v-model="form.acceptanceNumber" placeholder="请输入受理号码"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="重复投诉次数" prop="numberOfRepeatedComplaints">
              <el-input v-model="form.numberOfRepeatedComplaints" placeholder="请输入重复投诉次数"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="工单流水号" prop="workOrderSerialNumber">
              <el-input v-model="form.workOrderSerialNumber" placeholder="请输入工单流水号"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="回访人员" prop="returningVisitor">
              <el-input v-model="form.returningVisitor" placeholder="请输入回访人员"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉类型" prop="typeOfComplaint">
              <el-select v-model="form.typeOfComplaint" placeholder="请选择投诉类型">
                <el-option v-for="dict in dict.type.type_of_complaint"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="归一化地址" prop="normalizedAddress">
              <el-input v-model="form.normalizedAddress" placeholder="请输入归一化地址"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="归一化地址(TOP统计)" prop="normalizedAddressStatistics">
              <el-input v-model="form.normalizedAddressStatistics" placeholder="请输入归一化地址(TOP统计)"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="优先级" prop="priority">
              <el-input v-model="form.priority" placeholder="请输入优先级"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉区县" prop="complaintDistrict">
              <el-select v-model="form.complaintDistrict" placeholder="请选择投诉区县">
                <el-option v-for="dict in dict.type.complaint_district"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.label"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉详细地址" prop="complaintAddress">
              <el-input v-model="form.complaintAddress" placeholder="请输入投诉详细地址"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="问题描述" prop="problemDescription">
              <el-input v-model="form.problemDescription" placeholder="请输入问题描述"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="问题定界" prop="problemDelimiting">
              <el-select v-model="form.problemDelimiting" placeholder="请选择问题定界">
                <el-option v-for="dict in dict.type.problem_delimiting"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="问题分类" prop="problemClassification">
              <el-select v-model="form.problemClassification" placeholder="请选择问题分类">
                <el-option v-for="dict in dict.type.problem_classification"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="业务分类" prop="serviceClassification">
              <el-select v-model="form.serviceClassification" placeholder="请选择业务">
                <el-option v-for="dict in dict.type.service_classification"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉网络制式" prop="complaintNetworkSystem">
              <el-select v-model="form.complaintNetworkSystem" placeholder="请选择投诉网络制式">
                <el-option v-for="dict in dict.type.complaint_network_system"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="覆盖场景" prop="overlayScene">
              <el-select v-model="form.overlayScene" placeholder="请选择覆盖场景">
                <el-option v-for="dict in dict.type.overlay_scene"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="当前进展" prop="currentProgress">
              <el-input v-model="form.currentProgress" placeholder="请输入当前进展"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="当前环节" prop="currentLink">
              <el-select v-model="form.currentLink" placeholder="请选择当前环节">
                <el-option v-for="dict in dict.type.work_order_link"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="解决方案大类" prop="solutionCategory">
              <el-select v-model="form.solutionCategory" placeholder="请选择解决方案大类">
                <el-option v-for="dict in dict.type.solution_category"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="解决方案小类" prop="solutionSubclass">
              <el-select v-model="form.solutionSubclass" placeholder="请选择解决方案小类">
                <el-option v-for="dict in dict.type.solution_subclass"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否存在工期" prop="existenceDuration">
              <el-input v-model="form.existenceDuration" placeholder="请输入是否存在工期"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="存在工期名称" prop="existenceDurationName">
              <el-select v-model="form.existenceDurationName" placeholder="请选择存在工期名称">
                <el-option v-for="dict in dict.type.duration_name"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="具体方案" prop="specificScheme">
              <el-input v-model="form.specificScheme" placeholder="请输入具体方案"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="经度" prop="longitude">
              <el-input v-model="form.longitude" placeholder="请输入经度"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="纬度" prop="latitude">
              <el-input v-model="form.latitude" placeholder="请输入纬度"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="方案处理进展" prop="projectProcessingProgress">
              <el-input v-model="form.projectProcessingProgress" placeholder="请输入方案处理进展"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="方案是否落地" prop="planImplementation">
              <el-input v-model="form.planImplementation" placeholder="请输入方案是否落地"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用户10分评价意愿" prop="userEvaluationIntention">
              <el-select v-model="form.userEvaluationIntention" placeholder="请选择用户10分评价意愿">
                <el-option v-for="dict in dict.type.user_rating"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否上传闭环录音" prop="uploadClosedLoopRecording">
              <el-input v-model="form.uploadClosedLoopRecording" placeholder="请输入是否上传闭环录音"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉安抚责任人" prop="complaintsAppeaseThoseResponsible">
              <el-input v-model="form.complaintsAppeaseThoseResponsible" placeholder="请输入投诉安抚责任人"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉处理组" prop="complaintsHandlingUnit">
              <el-select v-model="form.complaintsHandlingUnit" placeholder="请选择投诉处理组">
                <el-option v-for="dict in dict.type.complaints_handling_unit"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉工单派发日期" prop="dateOfComplaint">
              <el-date-picker v-model="form.dateOfComplaint" type="date" placeholder="选择投诉工单派发日期" value-format="yyyy/MM/dd"
                              style="width: 100%;"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="处理责任人更新反馈时间" prop="updateFeedbackTime">
              <el-date-picker v-model="form.updateFeedbackTime" type="datetime" placeholder="选择处理责任人更新反馈时间"
                              style="width: 100%;"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="用户闭环时间" prop="closedLoopTime">
              <el-date-picker v-model="form.closedLoopTime" type="datetime" placeholder="选择用户闭环时间"
                              style="width: 100%;"></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉处理备注" prop="complaintHandlingRemarks">
              <el-input v-model="form.complaintHandlingRemarks" placeholder="请输入投诉处理备注"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="投诉是否反馈更新" prop="complaintFeedbackUpdate">
              <el-input v-model="form.complaintFeedbackUpdate" placeholder="请输入投诉是否反馈更新"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="自投诉起时长" prop="timeSinceTheComplaint">
              <el-input v-model="form.timeSinceTheComplaint" placeholder="请输入自投诉起时长"/>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否超时工单标记" prop="overtimeWorkOrderFlag">
              <el-select v-model="form.overtimeWorkOrderFlag" placeholder="请选择是否超时工单标记">
                <el-option v-for="dict in dict.type.overtime_work_order_flag"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="工单状态" prop="workOrderStatus">
              <el-select v-model="form.workOrderStatus" placeholder="请选择工单状态">
                <el-option v-for="dict in dict.type.work_order_status"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="预约客户时间" prop="reserveCustomerTime">
              <el-date-picker v-model="form.reserveCustomerTime" type="date" placeholder="选择预约客户时间" value-format="yyyy/MM/dd"
                              style="width: 100%;"></el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="方案是否通过" prop="approved">
              <el-select v-model="form.approved" placeholder="请选择方案是否通过">
                <el-option v-for="dict in dict.type.approved"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="问题类型" prop="problemType">
              <el-select v-model="form.problemType" placeholder="请选择问题类型">
                <el-option v-for="dict in dict.type.problem_type"
                           :key="dict.value"
                           :label="dict.label"
                           :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="审核意见" prop="planFailedReason">
              <el-input v-model="form.planFailedReason" placeholder="请输入审核意见"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  addComplaint,
  delComplaint,
  getComplaint,
  getLandedList,
  listComplaint,
  updateComplaint
} from "@/api/system/complaint";
import {getToken} from "@/utils/auth";

export default {
  dicts: ['type_of_complaint', 'complaint_district', 'problem_delimiting', 'problem_classification', 'complaint_network_system', 'overlay_scene', 'work_order_link', 'solution_category', 'solution_subclass', 'duration_name', 'user_rating', 'complaints_handling_unit', 'overtime_work_order_flag', 'work_order_status', 'service_classification', 'approved', 'problem_type', 'is_over_time'],
  name: "Complaint",
  data() {
    return {
      uploadUrl: process.env.VUE_APP_BASE_API + "/system/complaint/importExcel", // 上传的图片服务器地址
      headers: {
        Authorization: "Bearer " + getToken()
      },
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 投诉问题表格数据
      complaintList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        workOrderStatus: '5', // 添加这个属性并设置默认值
        complaintDate: null,
        acceptanceNumber: null,
        numberOfRepeatedComplaints: null,
        workOrderSerialNumber: null,
        returningVisitor: null,
        typeOfComplaint: null,
        normalizedAddress: null,
        normalizedAddressStatistics: null,
        priority: null,
        complaintDistrict: null,
        complaintAddress: null,
        problemDescription: null,
        problemDelimiting: null,
        problemClassification: null,
        serviceClassification: null,
        complaintNetworkSystem: null,
        overlayScene: null,
        currentProgress: null,
        currentLink: null,
        solutionCategory: null,
        solutionSubclass: null,
        existenceDuration: null,
        existenceDurationName: null,
        specificScheme: null,
        longitude: null,
        latitude: null,
        projectProcessingProgress: null,
        planImplementation: null,
        userEvaluationIntention: null,
        uploadClosedLoopRecording: null,
        complaintsAppeaseThoseResponsible: null,
        complaintsHandlingUnit: null,
        dateOfComplaint: null,
        updateFeedbackTime: null,
        closedLoopTime: null,
        complaintHandlingRemarks: null,
        complaintFeedbackUpdate: null,
        timeSinceTheComplaint: null,
        overtimeWorkOrderFlag: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      gerRowKeys(row) {
        return row.id
      },
      expands: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handleExpandChange(row, expandedRows) {
      var that = this
      if (expandedRows.length > 0) {
        this.expands = [];
        // 如果当前展开的行数大于1，则关闭上一个展开的行
        if (row) {
          that.expands.push(row.id)
        }
      } else {
        that.expands = []
      }
    },
    downloadImages(row) {

      this.$download.zip("/system/complaintFieldFile/images?id=" + row.id, "image.zip");
    },

    /** 查询投诉问题列表 */
    getList() {
      this.loading = true;
      // getLandedList => listComplaint
      listComplaint(this.queryParams).then(response => {
        this.complaintList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        complaintDate: null,
        acceptanceNumber: null,
        numberOfRepeatedComplaints: null,
        workOrderSerialNumber: null,
        returningVisitor: null,
        typeOfComplaint: null,
        normalizedAddress: null,
        normalizedAddressStatistics: null,
        priority: null,
        complaintDistrict: null,
        complaintAddress: null,
        problemDescription: null,
        problemDelimiting: null,
        problemClassification: null,
        serviceClassification: null,
        complaintNetworkSystem: null,
        overlayScene: null,
        currentProgress: null,
        currentLink: null,
        solutionCategory: null,
        solutionSubclass: null,
        existenceDuration: null,
        existenceDurationName: null,
        specificScheme: null,
        longitude: null,
        latitude: null,
        projectProcessingProgress: null,
        planImplementation: null,
        userEvaluationIntention: null,
        uploadClosedLoopRecording: null,
        complaintsAppeaseThoseResponsible: null,
        complaintsHandlingUnit: null,
        dateOfComplaint: null,
        updateFeedbackTime: null,
        closedLoopTime: null,
        complaintHandlingRemarks: null,
        complaintFeedbackUpdate: null,
        timeSinceTheComplaint: null,
        overtimeWorkOrderFlag: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加投诉问题";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getComplaint(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改投诉问题";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateComplaint(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addComplaint(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除投诉问题编号为"' + ids + '"的数据项？').then(function () {
        return delComplaint(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    handleSuccess(response, file) {
      if (response.code === 200) {
        this.$message({
          dangerouslyUseHTMLString: true,
          message: "文件：《" + file.name + "》导入成功",
          type: file.status
        });
      }
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/complaint/export', {
        ...this.queryParams
      }, `投诉问题跟踪表-${this.formatLocalDate(new Date())}.xlsx`)
    },
    formatLocalDate(date) {
      return (
        date.getFullYear() + '-' +
        (date.getMonth() + 1).toString().padStart(2, '0') + '-' +
        date.getDate().toString().padStart(2, '0')
      );
    }
  }
};
</script>
